import 'package:fijkplayer/fijkplayer.dart';
import 'package:flutter/material.dart';

///V6相机实时视频
class V6Video extends StatefulWidget {
  final String path;

  const V6Video({Key? key, required this.path}) : super(key: key);

  @override
  _V6VideoState createState() => _V6VideoState();
}

class _V6VideoState extends State<V6Video> {
  final FijkPlayer _player = FijkPlayer();

  @override
  initState() {
    super.initState();
    _player.setDataSource(widget.path,autoPlay: true);
  }

  @override
  void dispose() {
    _player.release();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return FijkView(
      player: _player,
      fit: FijkFit.cover,
      cover: AssetImage("assets/images/rc.jpg"),
    );
  }
}
